from django.http import HttpResponse

def convert(request):
	if 'source' in request.POST:
		sourcecode = request.POST['source']
		sourcecode = sourcecode.replace(' ', '&nbsp;')
		sourcecode = sourcecode.replace('<', '&amp;lt;')
		sourcecode = sourcecode.replace('>', '&amp;gt;')
		sourcecode = sourcecode.replace('\"', '&amp;quot;')
		sourcecode = sourcecode.replace('\t','&nbsp;&nbsp;&nbsp;&nbsp;')
		#sourcecode = sourcecode.replace('\n','<br />')
		sourcecode ='''<html><title>publish code</title><head><style type="text/css">#ta1 {height: 600px;width: 600px;}</style></head><body>'''+'''<textarea id="ta1" name = "ans"  onmouseover="focus()" onfocus="select()">''' + sourcecode+ '''</textarea></body></html>'''
		return HttpResponse(sourcecode)
	
